package com.itheima.controller;

import com.itextpdf.io.font.PdfEncodings;
import com.itextpdf.kernel.events.PdfDocumentEvent;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfPage;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.borders.Border;
import com.itextpdf.layout.element.AreaBreak;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.element.Table;
import com.itextpdf.layout.properties.AreaBreakType;
import com.itextpdf.layout.properties.TextAlignment;
import com.itextpdf.layout.properties.UnitValue;
import com.itheima.common.DefaultException;
import com.itheima.common.R;
import com.itheima.mapper.UserMapper;
import com.itheima.service.TestService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

/**
 * <h1>ysm</h1>
 *
 * @author <a href="11n_yd2h5e1jx8@dingtalk.com">叶世铭</a>
 * @since 2023/8/21
 */
@RestController
@RequestMapping("test")
public class TestController {

    @Resource
    private UserMapper userMapper;
    @Resource
    private TestService testService;

    @GetMapping("")
    public void test() {
        userMapper.testBatch();
    }

    @PostMapping("upload")
    public R<String> upload(@RequestParam("file") MultipartFile file) throws DefaultException {
        return R.success(testService.upload(file));
    }

    @GetMapping("downLoad")
    public void downLoad(HttpServletResponse response, String filePath) throws DefaultException {
        testService.downLoad(response, filePath);
    }

//    public static void main(String[] args) throws IOException {
//        String htmlUrl="src/main/java/com/itheima/controller/使用 itext html转成pdf的正确姿势-腾讯云开发者社区-腾讯云.html";
//        String pdfHome="src/main/java/com/itheima/controller/";
//        String pdfUrl="src/main/java/com/itheima/controller/test.pdf";
//        File file = new File(pdfHome);
//        file.mkdirs();
//        HtmlConverter.convertToPdf(new File(htmlUrl),new File(pdfUrl));
//    }


    @GetMapping("testPdf")
    public void testPdf(HttpServletResponse response) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        ServletOutputStream outputStream = response.getOutputStream();
        PdfWriter writer = new PdfWriter(byteArrayOutputStream);
        PdfDocument pdfDocument = new PdfDocument(writer);
        Document document = new Document(pdfDocument, PageSize.A4.rotate());
        document.setMargins(100, 20, 30, 20);
        URL resource = getClass().getResource("src/main/resources/AlimamaShuHeiTi-Bold.ttf");
        PdfFont font = PdfFontFactory.createFont("src/main/resources/AlimamaShuHeiTi-Bold.ttf", PdfEncodings.IDENTITY_H);


        // 页眉页脚事件监听器
        PdfHeaderFooterEvent pdfHeaderFooterEvent = new PdfHeaderFooterEvent();
        pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE, pdfHeaderFooterEvent);

/*        Table c = new Table(UnitValue.createPercentArray(3)).useAllAvailableWidth();
        c.addHeaderCell(new Cell().add(imageParagraph).setBorder(Border.NO_BORDER));
        c.addHeaderCell(new Cell().add(title).setBorder(Border.NO_BORDER));
        document.add(c);*/


        Paragraph businessName = new Paragraph("商家名称：贵州格林威治美程化妆品有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph billingCycle = new Paragraph("账单周期：2023.11").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.RIGHT);

        addTableWithOutBorder(document, 2, new int[]{1, 1}, businessName, billingCycle);
//        Table row2 = new Table(UnitValue.createPercentArray(2)).useAllAvailableWidth();
//        row2.addCell(new Cell().add(businessName).setBorder(Border.NO_BORDER));
//        row2.addCell(new Cell().add(billingCycle).setBorder(Border.NO_BORDER));
//
//        document.add(row2);

        Paragraph paymentMethod = new Paragraph("结款方式：现货现款 / 现货现款-下单平台钱包账户").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph statementCode = new Paragraph("对账单编码：XXDZ202312061234567890").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.RIGHT);

        addTableWithOutBorder(document, 2, new int[]{1, 1}, paymentMethod, statementCode);
//        Table row3 = new Table(UnitValue.createPercentArray(2)).useAllAvailableWidth();
//        row3.addCell(new Cell().add(paymentMethod).setBorder(Border.NO_BORDER));
//        row3.addCell(new Cell().add(statementCode).setBorder(Border.NO_BORDER));
//
//        document.add(row3);

        Paragraph billCurrency = new Paragraph("账单币种：CNY（人民币）").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        document.add(billCurrency);

        Paragraph currentBillingDetails = new Paragraph("本期账单明细").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(currentBillingDetails);


        // 表格
        Table table1 = new Table(UnitValue.createPercentArray(new float[]{20f, 12f, 12f, 25f, 20f, 30f})).useAllAvailableWidth();
        int column1 = 6;
        List<String> table1HeadList = List.of("记账时间", "账单描述", "结算金额", "关联订单号", "关联订单签收时间", "关联收货地址");
        addTableHead(table1, column1, table1HeadList);
        addTableColumnMerge(table1, 1, column1, "订单", TextAlignment.LEFT);
        //造的数据

        List<List<Object>> lists = new ArrayList<>();
        for (int i = 0; i < 47; i++) {
            List<Object> mid = List.of(i, 8, 9, 10, 11, 12);
            lists.add(mid);
        }
        addTableData(table1, column1, lists);
        addTableColumnMerge(table1, 1, column1, "售后退款", TextAlignment.LEFT);
        //第二份数据
        List<List<Object>> lists2 = new ArrayList<>();
        List<Object> midList2 = List.of(1, 2, 9, 10, 11, 12);
        lists2.add(midList2);
        addTableData(table1, column1, lists2);
        addTableColumnMerge(table1, 1, column1, "其他费用项", TextAlignment.LEFT);
        //第三份数据
        List<List<Object>> lists3 = new ArrayList<>();
        List<Object> midList3 = List.of(1, 8, 9, 10, 11, 12);
        lists3.add(midList3);
        addTableData(table1, column1, lists3);
        addTableColumnMerge(table1, 1, column1, "本期商家应付合计：48500.00", TextAlignment.CENTER);
        document.add(table1);

        Paragraph orderDetails = new Paragraph("本期订单明细").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(orderDetails);


        int column3 = 12;
        Table table3 = new Table(UnitValue.createPercentArray(column3)).useAllAvailableWidth();
        List<String> table3HeadList = List.of("下单时间", "订单编号", "订单类型", "产品名称", "规格", "单位",
                "订货数量", "进货单价", "配赠数量", "总数量", "折扣金额", "折后金额");
        addTableHead(table3, column3, table3HeadList);
        List<List<Object>> lists5 = new ArrayList<>();
        List<Object> midList5 = List.of(1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18);
        lists5.add(midList5);
        addTableData(table3, column3, lists5);
        document.add(table3);

        Paragraph afterSalesReturnDetails = new Paragraph("本期售后退货明细").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(afterSalesReturnDetails);


        int column4 = 8;
        Table table4 = new Table(UnitValue.createPercentArray(column4)).useAllAvailableWidth();
        List<String> table4HeadList = List.of("售后时间", "售后单号", "退货产品名称", "规格", "单位",
                "退货单价", "退货数量", "退货总价");
        addTableHead(table4, column4, table4HeadList);
        List<List<Object>> lists6 = new ArrayList<>();
        List<Object> midList6 = List.of(1, 2, 9, 10, 11, 12, 13, 14);
        lists6.add(midList6);
        addTableData(table4, column4, lists6);
        document.add(table4);

        PdfPage page = pdfDocument.getPage(pdfDocument.getNumberOfPages());
        float totalHeight = page.getArtBox().getHeight();
        float currentHeight = document.getRenderer().getCurrentArea().getBBox().getHeight();
        if (totalHeight - currentHeight > 385) {
            document.add(new AreaBreak(AreaBreakType.NEXT_PAGE));
        }

        Paragraph currentSettlement = new Paragraph("本期结算").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(currentSettlement);


        int column2 = 5;
        Table table2 = new Table(UnitValue.createPercentArray(column2)).useAllAvailableWidth();
        List<String> table2HeadList = List.of("摘要", "期初余额", "商家打款金额", "本期结款金额", "期末余额");
        addTableHead(table2, column2, table2HeadList);
        List<List<Object>> lists4 = new ArrayList<>();
        List<Object> midList4 = List.of(1, 8, 9, 10, 11);
        lists4.add(midList4);
        addTableData(table2, column2, lists4);
        document.add(table2);


        Paragraph tips = new Paragraph("提示：请核对无误。如有问题，请及时与我们联系").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        document.add(tips);


        Paragraph supplyUnit = new Paragraph("供货单位：广州慕可生物科技有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph takeUnit = new Paragraph("收货单位：贵州格林威治美程化妆品有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, supplyUnit, takeUnit);


        Paragraph supplyContacts = new Paragraph("供货方联系人：业务员").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph contacts = new Paragraph("联系人：").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, supplyContacts, contacts);


        Paragraph supplyContactsInformation = new Paragraph("供货方联系方式：（020）89851590").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph contactsPhone = new Paragraph("联系电话：").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, supplyContactsInformation, contactsPhone);


        Paragraph sender = new Paragraph("发送方：（盖章）广州慕可生物科技有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph recipient = new Paragraph("接受方：（盖章）贵州格林威治美程化妆品有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, sender, recipient);

        document.close();

        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
        outputStream.write(byteArrayOutputStream.toByteArray());
        // oss上传


        // 设置响应头
//        response.setHeader("Content-Disposition", "inline; filename=hello.pdf");
//        response.setCharacterEncoding("utf-8");
    }

    /**
     * 加入无边框表格
     *
     * @param document 文件对象
     * @param column   表格列数
     * @param index    插入的位置（1为插入，其余为不插入）
     * @param args     插入的元素
     */
    public void addTableWithOutBorder(Document document, int column, int[] index, Paragraph... args) {
        Table table = new Table(UnitValue.createPercentArray(column)).useAllAvailableWidth();
        int num = 0;
        for (int i = 0; i < column; i++) {
            if (index[i] == 1) {
                table.addCell(new Cell().add(args[num]).setBorder(Border.NO_BORDER));
                num++;
            }
        }
        document.add(table);
    }

    /**
     * 加入表格头
     *
     * @param table         表格对象
     * @param column        表格列数
     * @param tableHeadList 表格头内容集合
     * @throws IOException 异常
     */
    public void addTableHead(Table table, int column, List<String> tableHeadList) throws IOException {
        PdfFont font = PdfFontFactory.createFont("src/main/resources/AlimamaShuHeiTi-Bold.ttf", PdfEncodings.IDENTITY_H);
        for (int i = 0; i < column; i++) {
            Paragraph content = new Paragraph(tableHeadList.get(i)).setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
            table.addHeaderCell(new Cell().add(content).setKeepTogether(true));
        }
    }

    /**
     * 加入合并单元格
     *
     * @param table         表格对象
     * @param row           行数
     * @param column        列数
     * @param text          文本内容
     * @param layout        文本对齐方式
     * @throws IOException 异常
     */
    public void addTableColumnMerge(Table table, int row, int column, String text, TextAlignment layout) throws IOException {
        PdfFont font = PdfFontFactory.createFont("src/main/resources/AlimamaShuHeiTi-Bold.ttf", PdfEncodings.IDENTITY_H);
        Paragraph content = new Paragraph(text).setFont(font).setFontSize(10L).setTextAlignment(layout);
        table.addCell(new Cell(row, column).add(content).setKeepTogether(true));
    }

    /**
     * 加入表格数据
     *
     * @param table         表格对象
     * @param column        表格列数
     * @param tableDataList 表格数据集合
     * @throws IOException 异常
     */
    public void addTableData(Table table, int column, List<List<Object>> tableDataList) throws IOException {
        PdfFont font = PdfFontFactory.createFont("src/main/resources/AlimamaShuHeiTi-Bold.ttf", PdfEncodings.IDENTITY_H);
        for (int i = 0; i < tableDataList.size(); i++) {
            List<Object> tableData = tableDataList.get(i);
            for (int j = 0; j < column; j++) {
                Paragraph content = new Paragraph(tableData.get(j).toString()).setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
                table.addCell(new Cell().add(content).setKeepTogether(true).setMaxWidth(table.getColumnWidth(j).getValue()));
            }
        }
    }


    @GetMapping("testPdf2")
    public void testPdf2(HttpServletResponse response) throws IOException {
        ServletOutputStream outputStream = response.getOutputStream();
        PdfWriter writer = new PdfWriter(outputStream);
        PdfDocument pdfDocument = new PdfDocument(writer);
        Document document = new Document(pdfDocument, PageSize.A4.rotate());
        document.setMargins(100, 20, 30, 20);
        PdfFont font = PdfFontFactory.createFont("src/main/resources/AlimamaShuHeiTi-Bold.ttf", PdfEncodings.IDENTITY_H);

        // 页眉页脚事件监听器
        PdfHeaderFooterEvent pdfHeaderFooterEvent = new PdfHeaderFooterEvent();
        pdfDocument.addEventHandler(PdfDocumentEvent.END_PAGE, pdfHeaderFooterEvent);



/*        Table c = new Table(UnitValue.createPercentArray(3)).useAllAvailableWidth();
        c.addHeaderCell(new Cell().add(imageParagraph).setBorder(Border.NO_BORDER));
        c.addHeaderCell(new Cell().add(title).setBorder(Border.NO_BORDER));
        document.add(c);*/


        Paragraph businessName = new Paragraph("商家名称：贵州格林威治美程化妆品有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph billingCycle = new Paragraph("账单周期：2023.11").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.RIGHT);

        addTableWithOutBorder(document, 2, new int[]{1, 1}, businessName, billingCycle);
//        Table row2 = new Table(UnitValue.createPercentArray(2)).useAllAvailableWidth();
//        row2.addCell(new Cell().add(businessName).setBorder(Border.NO_BORDER));
//        row2.addCell(new Cell().add(billingCycle).setBorder(Border.NO_BORDER));
//
//        document.add(row2);

        Paragraph paymentMethod = new Paragraph("结款方式：月结 / 实销实结").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph statementCode = new Paragraph("对账单编码：XXDZ202312061234567890").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.RIGHT);

        addTableWithOutBorder(document, 2, new int[]{1, 1}, paymentMethod, statementCode);
//        Table row3 = new Table(UnitValue.createPercentArray(2)).useAllAvailableWidth();
//        row3.addCell(new Cell().add(paymentMethod).setBorder(Border.NO_BORDER));
//        row3.addCell(new Cell().add(statementCode).setBorder(Border.NO_BORDER));
//
//        document.add(row3);

        Paragraph billCurrency = new Paragraph("账单币种：CNY（人民币）").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        document.add(billCurrency);

        Paragraph currentAccountingDetails = new Paragraph("本期账务明细").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(currentAccountingDetails);


        // 表格
        Table table1 = new Table(UnitValue.createPercentArray(new float[]{20f, 12f, 12f, 25f, 20f, 30f})).useAllAvailableWidth();
        int column1 = 6;
        List<String> table1HeadList = List.of("记账时间", "账单描述", "结算金额", "关联订单号", "关联订单签收时间", "关联收货地址");
        addTableHead(table1, column1, table1HeadList);
        addTableColumnMerge(table1, 1, column1, "订单", TextAlignment.LEFT);
        //造的数据

        List<List<Object>> lists = new ArrayList<>();
        for (int i = 0; i < 47; i++) {
            List<Object> mid = List.of(i, 8, 9, 10, 11, 12);
            lists.add(mid);
        }
        addTableData(table1, column1, lists);
        addTableColumnMerge(table1, 1, column1, "售后退款", TextAlignment.LEFT);
        //第二份数据
        List<List<Object>> lists2 = new ArrayList<>();
        List<Object> midList2 = List.of(1, 2, 9, 10, 11, 12);
        lists2.add(midList2);
        addTableData(table1, column1, lists2);
        addTableColumnMerge(table1, 1, column1, "其他费用项", TextAlignment.LEFT);
        //第三份数据
        List<List<Object>> lists3 = new ArrayList<>();
        List<Object> midList3 = List.of(1, 8, 9, 10, 11, 12);
        lists3.add(midList3);
        addTableData(table1, column1, lists3);
        addTableColumnMerge(table1, 1, column1, "本期商家应付合计：48500.00", TextAlignment.CENTER);
        document.add(table1);

        Paragraph currentSettlement = new Paragraph("本期结算").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(currentSettlement);


        int column2 = 4;
        Table table2 = new Table(UnitValue.createPercentArray(column2)).useAllAvailableWidth();
        List<String> table2HeadList = List.of("摘要", "本期商家应付总额", "期初余额", "本期商家" );
        addTableHead(table2, column2, table2HeadList);
        List<List<Object>> lists4 = new ArrayList<>();
        List<Object> midList4 = List.of(1, 8, 9, 10);
        lists4.add(midList4);
        addTableData(table2, column2, lists4);
        document.add(table2);


        Paragraph orderDetails = new Paragraph("本期订单明细").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(orderDetails);


        int column3 = 12;
        Table table3 = new Table(UnitValue.createPercentArray(column3)).useAllAvailableWidth();
        List<String> table3HeadList = List.of("下单时间", "订单编号", "订单类型", "产品名称", "规格", "单位",
                "订货数量", "进货单价", "配赠数量", "总数量", "折扣金额", "折后金额");
        addTableHead(table3, column3, table3HeadList);
        List<List<Object>> lists5 = new ArrayList<>();
        List<Object> midList5 = List.of(1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18);
        lists5.add(midList5);
        addTableData(table3, column3, lists5);
        document.add(table3);

        PdfPage page = pdfDocument.getPage(pdfDocument.getNumberOfPages());
        float totalHeight = page.getArtBox().getHeight();
        float currentHeight = document.getRenderer().getCurrentArea().getBBox().getHeight();
        if (totalHeight - currentHeight > 385) {
            document.add(new AreaBreak(AreaBreakType.NEXT_PAGE));
        }
        Paragraph afterSalesReturnDetails = new Paragraph("本期售后退货明细").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.CENTER);
        document.add(afterSalesReturnDetails);


        int column4 = 8;
        Table table4 = new Table(UnitValue.createPercentArray(column4)).useAllAvailableWidth();
        List<String> table4HeadList = List.of("售后时间", "售后单号", "退货产品名称", "规格", "单位",
                "退货单价", "退货数量", "退货总价");
        addTableHead(table4, column4, table4HeadList);
        List<List<Object>> lists6 = new ArrayList<>();
        List<Object> midList6 = List.of(1, 2, 9, 10, 11, 12, 13, 14);
        lists6.add(midList6);
        addTableData(table4, column4, lists6);
        document.add(table4);

        Paragraph tips = new Paragraph("提示：请核对无误。如有问题，请及时与我们联系").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        document.add(tips);


        Paragraph supplyUnit = new Paragraph("供货单位：广州慕可生物科技有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph takeUnit = new Paragraph("收货单位：贵州格林威治美程化妆品有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, supplyUnit, takeUnit);


        Paragraph supplyContacts = new Paragraph("供货方联系人：业务员").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph contacts = new Paragraph("联系人：").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, supplyContacts, contacts);


        Paragraph supplyContactsInformation = new Paragraph("供货方联系方式：（020）89851590").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph contactsPhone = new Paragraph("联系电话：").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, supplyContactsInformation, contactsPhone);


        Paragraph sender = new Paragraph("发送方：（盖章）广州慕可生物科技有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        Paragraph recipient = new Paragraph("接受方：（盖章）贵州格林威治美程化妆品有限公司").setFont(font).setFontSize(10L).setTextAlignment(TextAlignment.LEFT);
        addTableWithOutBorder(document, 2, new int[]{1, 1}, sender, recipient);

        document.close();
    }

    public static void main(String[] args) throws IOException {
        PdfFont font = PdfFontFactory.createFont("F:\\frs.manage.fandow.com\\frs-manage-provider\\src\\main\\resources\\pdf\\AlimamaShuHeiTi-Bold.ttf", PdfEncodings.IDENTITY_H);
    }
}
